<?php

class nn{
    public $name="nullnamne";
    public $age="21924";
    public $color="red";
    public function jsonSerialize(){
        echo $this->name." ".$this->age;

}
}

 


$cc1=serialize(new nn);
$cc2=json_encode($cc1);
var_dump(unserialize(json_decode($cc2)));
 

